package com.project.study.farming.common.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 加载静态资源
 * @since 2020-04-14
 */
@Configuration
@Component
public class ResourceConfig implements WebMvcConfigurer {

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        String path = System.getProperty("user.dir")+"\\src\\main\\resources\\static\\images\\base\\";
        registry.addResourceHandler("/images/base/**").addResourceLocations("file:"+path);
    }
}
